<div id="information">
<br /><br />
<?php
if($_GET['check']!="check"){
$select_tut = mysql_query('SELECT * FROM tutorials WHERE teacher != "" AND locked = 0');
?>
<h3 class="form_h3">Избери самоучител</h3>
<div class="icons-panel">
<?php
while($row_tut = mysql_fetch_assoc($select_tut)){
   ?>
   <div class="icon">
   <?php
   echo '<a href="contents.php?name='.$row_tut['name'].'&check=check"><img src="../img/tut.png" height="80px" width="80px" alt="add" class="pic"/>';
   echo '</a><br />';
   echo $row_tut['name'];
   ?>
   </div>
   <?php } ?>
</div>
<?php
} elseif($_GET['check']=="check"){
   $select_art = mysql_query('SELECT * FROM articles WHERE to_tutorial = "'.$_GET['name'].'"');
   if(mysql_num_rows($select_art) == 0){
      echo '<p class="error">Няма уроци към този самоучител!</p>';
   } else {
   ?>
   <table border="1" style='border-collapse: collapse;'>
   <tr><td style='text-align: center;'><h4>Име на статията</h4></td>
       <td style='text-align: center;'><h4>Раздел</h4></td>    
   </tr>
   <?php
   while($row_art = mysql_fetch_assoc($select_art)){
      echo '<tr><td style="padding-left: 10px; padding-top: 5px;"><a href="../tutorials/see_articles.php?name='.$_GET['name'].'&amp;module='.$row_art['place'].'&amp;id='.$row_art['article_id'].'" class="f">'.$row_art['article_name'] . "</a><br /><br /></td>
	  <td style='width: 190px; text-align: left; padding-left: 10px;'>".$row_art['place']."</td>
	  </tr>";
   }
   ?>
   </table>
   <?php
}
}
?>
<br /><br />
</div>